package com.sccba.uop.demo.common.constant;

/**
 * 请求头字段
 */
public enum RequestHeaderField {
    X_UOP_API_CODE("X-Uop-Api-Code"),
    X_UOP_APP_ID("X-Uop-App-Id"),
    X_UOP_UNIQUE_NO("X-Uop-Unique-No"),
    X_UOP_TIMESTAMP("X-Uop-Timestamp"),
    X_UOP_SIGNATURE("X-Uop-Signature"),
    X_UOP_ENCRYPTED_KEY("X-Uop-Encrypted-Key"),
    X_UOP_AUTH_TOKEN("X-Uop-Auth-Token"),
    X_UOP_IP("X-Uop-Ip-Addr"),
    X_UOP_MAC("X-Uop-Mac-Addr"),
    X_UOP_LONGITUDE("X-Uop-Longitude"),
    X_UOP_LATITUDE("X-Uop-Latitude"),
    X_UOP_TERM_ID("X-Uop-Term-Id"),
    X_UOP_SIM_NO("X-Uop-Sim-No"),
    X_UOP_TERM_TYPE("X-Uop-Term-Type"),
    X_UOP_TERM_MODE("X-Uop-Term-Mode");

    //X_UOP_API_CODE("x-uop-api-code"),
    //X_UOP_APP_ID("x-uop-app-id"),
    //X_UOP_UNIQUE_NO("x-uop-unique-no"),
    //X_UOP_TIMESTAMP("x-uop-timestamp"),
    //X_UOP_SIGNATURE("x-uop-signature"),
    //X_UOP_ENCRYPTED_KEY("x-uop-encrypted-key"),
    //X_UOP_AUTH_TOKEN("x-uop-auth-token"),
    //X_UOP_IP("x-uop-ip-addr"),
    //X_UOP_MAC("x-uop-mac-addr"),
    //X_UOP_LONGITUDE("x-uop-longitude"),
    //X_UOP_LATITUDE("x-uop-latitude"),
    //X_UOP_TERM_ID("x-uop-term-Id"),
    //X_UOP_SIM_NO("x-uop-sim-No"),
    //X_UOP_TERM_TYPE("x-uop-term-type"),
    //X_UOP_TERM_MODE("x-uop-term-mode");

    private final String name;

    RequestHeaderField(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public RequestHeaderField from(String val) {
        RequestHeaderField[] values = RequestHeaderField.values();
        for (RequestHeaderField value : values) {
            if (value.name.equals(val)) {
                return value;
            }
        }
        return null;
    }

    public boolean eq(String val) {
        if (val == null || "".equals(val)) {
            return false;
        }
        return this.name.equals(val);
    }
}
